from typing import Union


class Employee:
    __name: str = None
    __salary: Union[int, float] = None

    def __init__(self, name: str, salary: Union[int, float]):
        self.__name = name
        self.__salary = salary

    def set_name(self, name: str):
        self.__name = name

    def get_name(self) -> str:
        return self.__name

    def set_salary(self, salary: Union[int, float]):
        self.__salary = salary

    def get_salary(self) -> Union[int, float]:
        return self.__salary

    def get_annual(self):
        return self.__salary * 12


class Worker(Employee):
    def work(self):
        print(f"普通工人 {super().get_name()} 正在工作中...")


class Manager(Employee):
    __bonus: Union[int, float] = None

    def __init__(self, name: str, salary: Union[int, float], bonus: Union[int, float]):
        super().__init__(name, salary)
        self.__bonus = bonus

    def manager(self):
        print(f"经理 {super().get_name()} 正在管理...")

    def get_annual(self):
        return super().get_annual() + self.__bonus


def show_emp_annual(e: Employee):
    print(f"{e.get_name()} 年工资是：{e.get_annual()}")


def working(emp: Union[Worker, Manager]):
    if isinstance(emp, Worker):
        emp.work()
    elif isinstance(emp, Manager):
        emp.manager()


worker: Worker = Worker("king", 10_000)
show_emp_annual(worker)
working(worker)

manager: Manager = Manager("tim", 20_000, 100_000)
show_emp_annual(manager)
working(manager)
